﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Application.DTO;
using Infrastructure.DC;

namespace Application.Task
{
    public class RetrieveCustomerById
    {
        private ICustomersDao _customersDao;
        public CustomerInfo CustomerInfo { get; private set; }
        private int _id;
         public RetrieveCustomerById(int id):this(id, new CustomersDao())
         {}
        public RetrieveCustomerById(int id, ICustomersDao customerDao)
        {
            _id = id;
            _customersDao = customerDao;
        }
        public void Execute()
        {
           var customer =  _customersDao.RetrieveById(_id);
            if (customer!=null)
            {
                CustomerInfo = new CustomerInfoMapper().From(customer);
            }

        }
    }
}
